/*package hoang.hut.app.facebook;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;

@SuppressWarnings({ "deprecation", "unused" })
public class FacebookManager {
	
	public static final String NAME = "name";
	public static final String DESCRIPTION = "description";
	public static final String PICTURE = "picture";
	public static final String LINK = "link";
	
	public static final int REQUEST_CODE = 1122;
	
	public static final String APP_ID_FACEBOOK = "170328309836961";
	private Facebook facebook;
	private AsyncFacebookRunner asyncFacebookRunner;

	private SharedPreferences preferences;
	private static final String KEY_TOKEN = "access_token";
    private static final String KEY_EXPIRES = "expires_in";
    private static final String KEY_SESSION = "facebook-session";

	private Activity activity;
	private DialogListener dialogListener;
	private Bundle mBundle;
	
	private boolean isSessionValid  = false;
	
	private CompleteListener completeListener;
	
	public interface CompleteListener{
		public void completeLogin(Bundle values);
		public void completePost(Bundle values);
		public void completeGetProfile(String response, Object state);
	}

	public FacebookManager(Activity activity) {
		this.activity = activity;
		facebook = new Facebook(APP_ID_FACEBOOK);
		asyncFacebookRunner = new AsyncFacebookRunner(facebook);
		mBundle = new Bundle();
		isSessionValid = restore(facebook);
	}

	*//**
	 * login facebook
	 *//*
	public void loginInFacebook() {
		
		facebook.authorize(activity,
				new String[] { "email", "publish_stream" }, REQUEST_CODE,
				new DialogListener() {

					@Override
					public void onFacebookError(FacebookError e) {
						Util.showAlert(activity, "FacebookError", e.getMessage());
					}

					@Override
					public void onError(DialogError e) {
						Util.showAlert(activity, "DialogError", e.getMessage());
					}

					@Override
					public void onComplete(Bundle values) {
						save(facebook, activity);
						completeListener.completeLogin(values);
					}

					@Override
					public void onCancel() {

					}
				});
	}
	
    public boolean save(Facebook session, Context context) {
        Editor editor = context.getSharedPreferences(KEY_SESSION, Context.MODE_PRIVATE).edit();
        editor.putString(KEY_TOKEN, session.getAccessToken());
        editor.putLong(KEY_EXPIRES, session.getAccessExpires());
        return editor.commit();
    }

    public boolean restore(Facebook session) {
        SharedPreferences savedSession = activity.getSharedPreferences(KEY_SESSION, Context.MODE_PRIVATE);
        session.setAccessToken(savedSession.getString(KEY_TOKEN, null));
        session.setAccessExpires(savedSession.getLong(KEY_EXPIRES, 0));
        return session.isSessionValid();
    }

    public static void clear(Context context) {
        Editor editor = context.getSharedPreferences(KEY_SESSION, Context.MODE_PRIVATE).edit();
        editor.clear();
        editor.commit();
    }

	*//**
	 * post to facebook
	 *//*
	public void postToWall() {
		if(mBundle!=null){
			facebook.dialog(activity, "feed", mBundle, new DialogListener() {
				
				@Override
				public void onFacebookError(FacebookError e) {
					Util.showAlert(activity, "Error", e.getMessage());
				}
				
				@Override
				public void onError(DialogError e) {
					Util.showAlert(activity, "Error", e.getMessage());
				}
				
				@Override
				public void onComplete(Bundle values) {
					completeListener.completePost(values);
				}
				
				@Override
				public void onCancel() {
					
				}
			});
		}else{
			facebook.dialog(activity, "feed", dialogListener);
		}
	}
	*//**
	 * get profile of user
	 *//*
	
	public void getProfileInformation() {
		
		asyncFacebookRunner.request("me", new RequestListener() {
			
			@Override
			public void onMalformedURLException(MalformedURLException e, Object state) {
				Util.showAlert(activity, "Error", e.getMessage());
			}
			
			@Override
			public void onIOException(IOException e, Object state) {
				Util.showAlert(activity, "Error", e.getMessage());
			}
			
			@Override
			public void onFileNotFoundException(FileNotFoundException e, Object state) {
				Util.showAlert(activity, "Error", e.getMessage());
			}
			
			@Override
			public void onFacebookError(FacebookError e, Object state) {
				Util.showAlert(activity, "Error", e.getMessage());
			}
			
			@Override
			public void onComplete(String response, Object state) {
				completeListener.completeGetProfile(response, state);
			}
		});
	}
	
	public String getProfile(){
		try {
			return facebook.request("me");
		} catch (MalformedURLException e) {
			e.printStackTrace();
			return null;
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	public void callBack(int requestCode, int resultCode, Intent data){
		facebook.authorizeCallback(requestCode, resultCode, data);
	}
	
	public void setLink(String link){
		mBundle.putString(LINK, link);
	}
	
	public void setPicture(String url){
		mBundle.putString(PICTURE, url);
	}
	
	public void setName(String name){
		mBundle.putString(NAME, name);
	}
	
	public void setDescription(String description){
		mBundle.putString(DESCRIPTION, description);
	}
	
	public void setOnCompleteListener(CompleteListener completeListener){
		this.completeListener = completeListener;
	}
	
	public Facebook getFacebook() {
		return facebook;
	}
	
	public boolean isSessionValid() {
		return isSessionValid;
	}
	
	public void logout(){
		try {
			facebook.logout(activity);
		} catch (MalformedURLException e) {
			Util.showAlert(activity, "Error", e.getMessage());
			e.printStackTrace();
		} catch (IOException e) {
			Util.showAlert(activity, "Error", e.getMessage());
			e.printStackTrace();
		}
	}
	
}
*/